Skip to content

Answer the question ADR 0004 said no documentation could - #41

Merged
ivanvyd merged 1 commit into
mainfrom
docs/chunk-mechanism-verified-live
Aug 5, 2026
Merged

Answer the question ADR 0004 said no documentation could#41
ivanvyd merged 1 commit into
mainfrom
docs/chunk-mechanism-verified-live

Conversation

@ivanvyd

@ivanvyd ivanvyd commented Aug 5, 2026

Copy link
Copy Markdown
Owner

ADR 0004 shipped with one premise it could not check. It has now been checked against the live Azure
workspace, and it holds.

The unknown, and the answer

Question: may a caller read the remaining chunks of a statement Genie executed on their behalf?
The link resolves to /api/2.0/sql/statements/…, which is not a Genie path, and nothing published
says whether the caller's identity carries there.

Answer: yes. A statement id taken from a completed Genie message, using the caller's own token:

Probe Result
GET /api/2.0/sql/statements/{genie-executed-id} HTTP 200, manifest, SUCCEEDED
GET .../result/chunks/0 HTTP 200, rows returned

The wire contract, checked the same way

A deliberately chunked statement — SELECT id, repeat('x',120) FROM range(60000), run through the
Statement Execution API so no table was created in the workspace:

Observation Value
manifest.total_chunk_count 2
manifest.truncated on a merely-chunked result false — the original defect's premise, now confirmed by observation rather than inferred
Chunk 0 41250 of 60000 rows
next_chunk_internal_link /api/2.0/sql/statements/{id}/result/chunks/1 — workspace-relative, the shape the client's host validation accepts
Following it HTTP 200, row_offset: 41250, row_count: 18750, no next_chunk_index
Sum 41250 + 18750 = 60000 = total_row_count

That is the link shape, the chunk response shape, the loop's termination condition, and the row
arithmetic the truncation flag depends on — all four.

What is still not proven, and every doc now says so

Genie itself emitting a multi-chunk result. The Agent used for verification has a six-row table
and Genie bounds its own SQL, so both halves are verified while their composition is not. Every
document that previously said "not exercised live" now says which half was and which was not,
because "verified" and "partly verified" are different claims and the second is the true one.

The unreachable-chunk fallback stays — not because the permission answer was expected to be no, but
because a path returning rows to a user should not rest on an assumption nobody re-checks.

Also recorded

The service-principal token endpoint returns 401 invalid_client, not 404, for deliberately
wrong credentials. The URL, method, HTTP Basic auth and form parameters in the documented recipe are
therefore correct, even though the exchange with real service-principal credentials has not been run.

Verification

Live suite 8/8 green against the workspace after the change. Full offline suite 224 tests green.
The CLI run end-to-end live returns a complete result correctly flagged truncated: false. All
relative links resolve. Documentation only — no source changes.

ADR 0004 shipped with one premise it could not check: whether a caller may
read the remaining chunks of a statement Genie executed on their behalf.
The link resolves to /api/2.0/sql/statements, which is not a Genie path,
and nothing published says whether the caller's identity carries there.

It does. A statement id taken from a completed Genie message returned HTTP
200 from both /api/2.0/sql/statements/{id} and .../result/chunks/0 using
the caller's own token, against the live Azure workspace.

The wire contract was checked the same way, on a deliberately chunked
statement run through the Statement Execution API so that no table had to
be created: total_chunk_count 2, chunk zero holding 41250 of 60000 rows, a
next_chunk_internal_link of /api/2.0/sql/statements/{id}/result/chunks/1 --
workspace-relative, the shape the client's host check accepts -- and
following it returning 18750 rows with no next_chunk_index. The two sum to
total_row_count exactly.

manifest.truncated was false on that result. That is the original defect's
premise, and it is now confirmed by observation rather than inferred from
the contract.

What is still not reached is Genie itself emitting a multi-chunk result.
The Agent used for verification has six rows and Genie bounds its own SQL,
so both halves are verified and their composition is not. Every document
that said "not exercised live" now says which half was and which was not,
because "verified" and "partly verified" are different claims and the
second one is the true one.

Also recorded: the service-principal token endpoint returns 401
invalid_client rather than 404 for deliberately wrong credentials, so the
URL, method, Basic auth and form parameters in the documented recipe are
right even though the exchange with real credentials has not been run.
@ivanvyd
ivanvyd merged commit dcf59b0 into main Aug 5, 2026
10 checks passed
@ivanvyd
ivanvyd deleted the docs/chunk-mechanism-verified-live branch August 5, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant